<?php

/**
 * ViewPlant form base class.
 *
 * @method ViewPlant getObject() Returns the current form's model object
 *
 * @package    seth
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseViewPlantForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'plant'       => new sfWidgetFormInputText(),
      'owner'       => new sfWidgetFormInputText(),
      'country'     => new sfWidgetFormInputText(),
      'city'        => new sfWidgetFormInputText(),
      'location'    => new sfWidgetFormInputText(),
      'coordinates' => new sfWidgetFormInputText(),
      'pm'          => new sfWidgetFormInputText(),
      'path'        => new sfWidgetFormInputText(),
      'pn'          => new sfWidgetFormInputText(),
      'type'        => new sfWidgetFormInputText(),
      'structure'   => new sfWidgetFormInputText(),
      'code'        => new sfWidgetFormInputText(),
      'internet'    => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'plant'       => new sfValidatorString(array('max_length' => 45)),
      'owner'       => new sfValidatorString(array('max_length' => 45)),
      'country'     => new sfValidatorString(array('max_length' => 45)),
      'city'        => new sfValidatorString(array('max_length' => 45)),
      'location'    => new sfValidatorString(array('max_length' => 45)),
      'coordinates' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'pm'          => new sfValidatorString(array('max_length' => 45)),
      'path'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'pn'          => new sfValidatorNumber(),
      'type'        => new sfValidatorString(array('max_length' => 45)),
      'structure'   => new sfValidatorString(array('max_length' => 45)),
      'code'        => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'internet'    => new sfValidatorString(array('max_length' => 45, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('view_plant[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ViewPlant';
  }

}
